<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="审批状态">
              <j-dict-select-tag
                placeholder="请选择审批状态"
                v-model="queryParam.examineStatus"
                dictCode="examine_status"
              />
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="备案类型">
              <j-dict-select-tag placeholder="请选择状态" v-model="queryParam.recordType" dictCode="record_type	" />
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">


      <!-- 高级查询区域 -->
    </div>

    <!-- table区域-begin -->
    <div>
     
      <a-table
        ref="table"
        size="middle"
        :scroll="{ x: true }"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        class="j-table-force-nowrap"
        @change="handleTableChange"
      >
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text, record">
          <span v-if="!text" style="font-size: 12px; font-style: italic">无图片</span>
          <img
            v-else
            :src="getImgView(text)"
            :preview="record.id"
            height="25px"
            alt=""
            style="max-width: 80px; font-size: 12px; font-style: italic"
          />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a-button type="primary" @click="check(record)"> 详情 </a-button>
        </span>
      </a-table>
    </div>
    <ExamineCompany :visible="companyVisible" :recordId="recordId" @close="close(0)"></ExamineCompany>
    <ExamineProduct :visible="productVisible" :recordId="recordId" @close="close(1)"></ExamineProduct>
    <ExamineCappacity :visible="cappacityVisible" :recordId="recordId" @close="close(2)"></ExamineCappacity>
    <ExamineSupply :visible="supplyVisible" :recordId="recordId" @close="close(3)"></ExamineSupply>
    <!-- <ExamineCompany :visible="companyVisible"></ExamineCompany> -->
    <!-- <zzzs-examine-modal ref="modalForm" @ok="modalFormOk"></zzzs-examine-modal> -->
  </a-card>
</template>
  
  <script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ExamineCompany from './modules/ZzzsRecordEnterpriseModalHave'
import ExamineProduct from './modules/ZzzsProductRecordingModalHave'
import ExamineCappacity from './modules/ZzzsRecordingOfProductionCapacityModalHave'
import ExamineSupply from './modules/ZzzsRecordOfSupplyAbilityModalHave'

import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'

export default {
  name: 'ZzzsExamineListMy',
  mixins: [JeecgListMixin, mixinDevice],
  components: { ExamineCompany, ExamineProduct, ExamineCappacity, ExamineSupply },
  data() {
    return {
      description: '审批表管理页面',
      companyVisible: false,
      productVisible: false,
      cappacityVisible: false,
      supplyVisible: false,
      recordId: '',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },

        {
          title: '审批人',
          align: 'center',
          dataIndex: 'examinePerson_dictText',
        },
        {
          title: '备案类型',
          align: 'center',
          dataIndex: 'recordType_dictText',
        },
        {
          title: '备案id',
          align: 'center',
          dataIndex: 'recordId',
        },
        {
          title: '审批状态',
          align: 'center',
          dataIndex: 'examineStatus_dictText',
        },
        {
          title: '审批意见',
          align: 'center',
          dataIndex: 'examineOpinion',
        },

        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 147,
          scopedSlots: { customRender: 'action' },
        },
      ],
      url: {
        list: '/modules/zzzsExamine/listRecorded',
        delete: '/modules/zzzsExamine/delete',
        deleteBatch: '/modules/zzzsExamine/deleteBatch',
        exportXlsUrl: '/modules/zzzsExamine/exportXls',
        importExcelUrl: 'modules/zzzsExamine/importExcel',
      },
      dictOptions: {},
      superFieldList: [],
    }
  },
  created() {
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    initDictConfig() {},
    //检验方法
    check(record) {
      console.log(record)
      this.recordId = record.recordId
      if (record.recordType == 0) {
        this.companyVisible = true
      } else if (record.recordType == 1) {
        this.productVisible = true
      } else if (record.recordType == 2) {
        this.cappacityVisible = true
      } else if (record.recordType == 3) {
        this.supplyVisible = true
        console.log(this.supplyVisible)
      }
    },
    close(type) {
      if (type == 0) {
        this.companyVisible = false
      } else if (type == 1) {
        this.productVisible = false
      } else if (type == 2) {
        this.cappacityVisible = false
      } else if (type == 3) {
        this.supplyVisible = false
      }
    },
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'int', value: 'examineStatus', text: '审批状态', dictCode: 'examine_status' })
      fieldList.push({ type: 'string', value: 'examinePerson', text: '审批人', dictCode: '' })
      fieldList.push({ type: 'string', value: 'examineOpinion', text: '审批意见', dictCode: '' })
      fieldList.push({ type: 'int', value: 'recordType', text: '备案类型', dictCode: 'record_type' })
      fieldList.push({ type: 'string', value: 'recordId', text: '备案id', dictCode: '' })
      this.superFieldList = fieldList
    },
  },
}
</script>
  <style scoped>
@import '~@assets/less/common.less';
</style>